/*  
     PlAr is Platform Arena: a 2D multiplayer shooting game
     Copyright (C) 2009 Ragagnin Antonio

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package plar.demo;

import java.io.IOException;

import javax.swing.JOptionPane;

import plar.ClientServer.Server;
import plar.core.Common;
import plar.elements.Level0;
import java.awt.Point;

public class server {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		   Common.info(Common.product+" ver:"+Common.version);
	       Common.info("Created by "+Common.author+" "+Common.copyright);
	       Common.info(Common.license);
		boolean silent=false;
		Server s = new Server();
		s.newGame(new Level0());
		s.g.resolution = new Point(800,600);
		for(int i=0;i<args.length;i++)
		{
			if(args[i].equals("--noGui")) silent=true;
			//Common.info("["+args[i]+"]");
		}
		if(s.listen(Common.port))
		{
			if(!silent)
			{
			JOptionPane.showMessageDialog(null,
				"Server is running, click Ok to quit", "Plar",
				JOptionPane.INFORMATION_MESSAGE);
			s.close();
			System.exit(0);
		}
		}else
		{
			s.close();
			System.exit(0);
		}

	}

}
